<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Platform extends Model
{
    use HasFactory, SoftDeletes;

    /**
     * 可批量赋值的属性
     *
     * @var array<string>
     */
    protected $fillable = [
        'name',
        'code',
        'logo',
        'description',
        'is_active',
        'settings',
    ];

    /**
     * 应该被转换为原生类型的属性
     *
     * @var array<string, string>
     */
    protected $casts = [
        'is_active' => 'boolean',
        'settings' => 'json',
    ];

    /**
     * 获取该平台下的所有网红
     */
    public function influencers(): HasMany
    {
        return $this->hasMany(Influencer::class);
    }
} 